<?php

/**
 * @author edson
 * @copyright 2011
 */
    ;
//echo getcwd();
class CDrawAdmin extends CDrawPage
{
    
    
    public static $instance;
    
    function DrawCheckBox($items)
    {
        echo "<p >";
      
      
      foreach($items as $id => $valor)
                    {
                        echo "<label><input class=\"input-checkboxes\" type=\"checkbox\" name='$id' value='$valor'>".$valor."</label>\n";
                        
                    }
      
      echo "</p>";
        
        
        
    }
    
    function DrawP($items)
    {
        
        foreach($items as $row => $colum){
            echo "<p class=\"admin-debug\">";
            echo "<h2>$row</h2>";
            //echo "</br>";
            
         foreach($colum as $id=>$valor)
         {
              
            echo "<label>".$valor."<input type='checkbox' name='$valor' class='input-checkboxes'>"."</label>";
            
         }
         }
        
        echo "</p>";
    }
    function DrawDivAdBegin(){$tab=func_get_args();if(count(func_get_args())>1){echo "<div id=\"$tab[0]\">";return;} echo "<div class=\"$tab[0]\">";}
    function DrawDivAdEnd(){echo "</div>"; }
    function DrawSubmmit($nombre){echo "<input class='submit_button' type='submit' name=$nombre value='$nombre'>";}
    function __construct()
    {
        
        
    }
    
    function DrawTable($title,$table,$campos)//obligatorio ID como campo inicial
    {   $qu="select ";
        foreach($campos as $id=>$valor)
        {   
            $qu=$qu."$id,";
        }
        $qu=substr($qu,0,strlen($qu)-1);
        $qu=$qu." from "."$table";
        echo "<div id='content_area_user_title'>";
        echo "<h2> $title</h2>";
        echo "</div>";
            echo "<div class='usersettings_statistics'>";
                    echo "<h3>$title</h3>";
                    echo "<table> <tbody>";
                       // $qu="select*from $table";
                        $table=CModelo::getInstance()->getData($qu);
                        //var_dump($table);
                        $cont=0;
                        $ruta=CConfig::getInstance()->rutalocal."/view";
                        foreach($table as $campo => $valor)
                        {   $cont=$cont+1;
                            
                            
                                if($cont%2){ 
                            
                                    echo "<tr class='odd'>";
                                    $i="";$cont=0;
                                    foreach($valor as $id=>$val)
                                    {   if($cont==0){$i=$val;}
                                        echo "<td>$val</td>";$cont=$cont+1;
                                    }
                                    /*---------------------------------------------------------------------------*/
                                    //          las referencias debbden de ser modificadas deacuerdo al directorio
                                    //
                                    /*---------------------------------------------------------------------------*/
                                    echo "<td> <a href='$ruta/Register.php?codigo=$i'>Editar</a>   </td>"; 
                                    echo "<td><a href='/edson1/modificar.php?codigo=$i'>Eliminar</a>   </td>";
                                    echo "</tr>";
                                    }
                                else
                                    {
                                    
                                     echo "<tr class='even'> ";
                                    $i2="";$cont2=0;
                                    foreach($valor as $id => $val)
                                    {   if($cont2==0){$i2=$val;}
                                        echo "<td>$val </td>";$cont2=$cont2+1;
                                    }
                                    echo "<td> <a href='$ruta/Register.php?codigo=$i2'>Editar</a>   </td>";        
                                    echo "<td><a href='/edson1/modificar.php?codigo=$i'>Eliminar</a>   </td>";
                                    echo "</tr>"; 
                                    }
                                    
                        }
                    echo "</tbody>  </table>";
                    
                    
            echo "</div>";
        
    }
    
    //public static function getInstance()
	//{
		//echo "<div id=register-box>";
      //  if(self::$instance==null)
	//	  self::$instance=new CDrawAdmin();
	//   echo "</div>";	  
	//	return  self::$instance;}	
}

?>